////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2017-2018 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// THIS IS AUTO-GENERATED CODE.  PLEASE DO NOT EDIT (File bug reports against tools).
///
/// Auto-generated by: ParameterParser V1.1.4
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @file  afpdafelements.cpp
/// @brief Auto-generated Chromatix parameter file
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#include "afpdafelements.h"
#include "parametersetmanager.h"

AFPDAFELEMENTS_NAMESPACE_BEGIN

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Default Constructor
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
chromatixPDAFTypeClass::chromatixPDAFTypeClass(
    const CHAR* name)
    : ParameterModule(name, MAJOR, MINOR, PATCH, 0, 0, 0, 0)
{
    PARAMETER_INITIALIZE(SymbolTableID);
    PARAMETER_INITIALIZE(module_version);
    PARAMETER_INITIALIZE(parameter_version);
    PARAMETER_INITIALIZE(is2PDEnable);
    PARAMETER_INITIALIZE(ROI);
    PARAMETER_INITIALIZE(focusTable);
    PARAMETER_INITIALIZE(noiseTable);
    PARAMETER_INITIALIZE(confidenceTable);
    PARAMETER_INITIALIZE(confidenceHighTable);
    PARAMETER_INITIALIZE(fallbackConfidence);
    PARAMETER_INITIALIZE(stableTable);
    PARAMETER_INITIALIZE(dofScalerTable);
    PARAMETER_INITIALIZE(focusScan);
    PARAMETER_INITIALIZE(sceneMonitor);
    PARAMETER_INITIALIZE(PDPreprocessing);
    PARAMETER_INITIALIZE(PDInternal);
    PARAMETER_INITIALIZE(PDMultiWindow);
    PARAMETER_INITIALIZE(enableCheckVHStatsRatio);
    PARAMETER_INITIALIZE(VHStatsRatioUnconfidentThreshold);
    PARAMETER_INITIALIZE(enablePDEarlyInterrupt);
    PARAMETER_INITIALIZE(ledPdafMaxFrameAllow);
    PARAMETER_INITIALIZE(sparsePDTouchFaceConfidenceThreshold);
    PARAMETER_INITIALIZE(sparsePDTouchFaceLowDefocusConfidenceThreshold);
    PARAMETER_INITIALIZE(enableEnterLSPLowConfidenceHunting);
    PARAMETER_INITIALIZE(LSPLowConfidenceHuntingThreshold);
    PARAMETER_INITIALIZE(face);
    PARAMETER_INITIALIZE(touch);
    PARAMETER_INITIALIZE(convergeDoneFilter);
    PARAMETER_INITIALIZE(forceEnterFineSearch);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Constructor
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
chromatixPDAFTypeClass::chromatixPDAFTypeClass(
    const CHAR* name,
    UINT32 modeId,
    UINT16 mode,
    UINT16 subMode,
    UINT32 group)
    : ParameterModule(name, MAJOR, MINOR, PATCH, modeId, mode, subMode, group)
{
    PARAMETER_INITIALIZE(SymbolTableID);
    PARAMETER_INITIALIZE(module_version);
    PARAMETER_INITIALIZE(parameter_version);
    PARAMETER_INITIALIZE(is2PDEnable);
    PARAMETER_INITIALIZE(ROI);
    PARAMETER_INITIALIZE(focusTable);
    PARAMETER_INITIALIZE(noiseTable);
    PARAMETER_INITIALIZE(confidenceTable);
    PARAMETER_INITIALIZE(confidenceHighTable);
    PARAMETER_INITIALIZE(fallbackConfidence);
    PARAMETER_INITIALIZE(stableTable);
    PARAMETER_INITIALIZE(dofScalerTable);
    PARAMETER_INITIALIZE(focusScan);
    PARAMETER_INITIALIZE(sceneMonitor);
    PARAMETER_INITIALIZE(PDPreprocessing);
    PARAMETER_INITIALIZE(PDInternal);
    PARAMETER_INITIALIZE(PDMultiWindow);
    PARAMETER_INITIALIZE(enableCheckVHStatsRatio);
    PARAMETER_INITIALIZE(VHStatsRatioUnconfidentThreshold);
    PARAMETER_INITIALIZE(enablePDEarlyInterrupt);
    PARAMETER_INITIALIZE(ledPdafMaxFrameAllow);
    PARAMETER_INITIALIZE(sparsePDTouchFaceConfidenceThreshold);
    PARAMETER_INITIALIZE(sparsePDTouchFaceLowDefocusConfidenceThreshold);
    PARAMETER_INITIALIZE(enableEnterLSPLowConfidenceHunting);
    PARAMETER_INITIALIZE(LSPLowConfidenceHuntingThreshold);
    PARAMETER_INITIALIZE(face);
    PARAMETER_INITIALIZE(touch);
    PARAMETER_INITIALIZE(convergeDoneFilter);
    PARAMETER_INITIALIZE(forceEnterFineSearch);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Destructor
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
chromatixPDAFTypeClass::~chromatixPDAFTypeClass()
{
    UnloadchromatixPDAFType(this);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// GetName
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
const CHAR* chromatixPDAFTypeClass::GetName(
    const CHAR* type)
{
    const CHAR* name = type;
    CHAR temp[ParameterFileSymbolTableEntry::TYPE_LEN + 1];
    if (PARAMETER_STRCMP(type, ParameterFileSymbolTableEntry::GetType(temp, "chromatixPDAF")) == 0)
    {
        name = "chromatixPDAF";
    }
    return name;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load chromatixPDMultiwindowType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixPDAFTypeClass::LoadchromatixPDMultiwindowType(
    ParameterFileSymbolTableEntry* entry,
    chromatixPDMultiwindowType* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadInt32(&structure->enable);
    result = result && entry->ReadFloat(&structure->HClipRatioNormalLight);
    result = result && entry->ReadFloat(&structure->VClipRatioNormalLight);
    result = result && entry->ReadFloat(&structure->HClipRatioLowLight);
    result = result && entry->ReadFloat(&structure->VClipRatioLowLight);
    result = result && entry->ReadFloat(&structure->HNumWindows);
    result = result && entry->ReadFloat(&structure->VNumWindows);
    result = result && entry->ReadFloat(&structure->PDPercentile);
    result = result && entry->ReadInt32(&structure->defocusThreshold);
    result = result && entry->ReadFloat(&structure->confidenceThMultiple);
    result = result && LoadchromatixPDMultiwindowType_multiDepthDetectStruct(entry, &structure->multiDepthDetect);
    result = result && LoadchromatixPDMultiwindowType_lowLightDetectStruct(entry, &structure->lowLightDetect);
    result = result && entry->ReadInt32(&structure->lockToPeripheralDuringSearch);
    result = result && LoadchromatixPDMultiwindowType_activZoomControlStruct(entry, &structure->activZoomControl);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load chromatixPDMultiwindowType_multiDepthDetectStruct
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixPDAFTypeClass::LoadchromatixPDMultiwindowType_multiDepthDetectStruct(
    ParameterFileSymbolTableEntry* entry,
    chromatixPDMultiwindowType::multiDepthDetectStruct* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadFloat(&structure->percentile);
    result = result && entry->ReadFloat(&structure->detectThLow);
    result = result && entry->ReadFloat(&structure->detectThHigh);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load chromatixPDMultiwindowType_lowLightDetectStruct
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixPDAFTypeClass::LoadchromatixPDMultiwindowType_lowLightDetectStruct(
    ParameterFileSymbolTableEntry* entry,
    chromatixPDMultiwindowType::lowLightDetectStruct* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadFloat(&structure->gainThLow);
    result = result && entry->ReadFloat(&structure->gainThHigh);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load chromatixPDMultiwindowType_activZoomControlStruct
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixPDAFTypeClass::LoadchromatixPDMultiwindowType_activZoomControlStruct(
    ParameterFileSymbolTableEntry* entry,
    chromatixPDMultiwindowType::activZoomControlStruct* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadInt32(&structure->enable);
    result = result && entry->ReadFloat(&structure->zoomThreshold);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load chromatixPDInternalType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixPDAFTypeClass::LoadchromatixPDInternalType(
    ParameterFileSymbolTableEntry* entry,
    chromatixPDInternalType* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadInt32(&structure->type);
    result = result && entry->ReadInt32(&structure->initialPosition);
    result = result && entry->ReadInt32(&structure->PDAFEnableFaceCAFPriority);
    result = result && entry->ReadFloat(&structure->incDefocusThresholdPreviousError);
    result = result && entry->ReadInt32(&structure->fineScanRangeEnhance);
    result = result && entry->ReadFloat(&structure->softRegionThresholdMultiplier);
    result = result && entry->ReadInt32(&structure->enableSoftConfidenceThreshold);
    result = result && entry->ReadFloat(&structure->softConfidenceThresholdDelta);
    result = result && entry->ReadFloat(&structure->softConfidenceFocus_pnt);
    result = result && entry->ReadInt32(&structure->enableSoftRegionThresholdHigh);
    result = result && entry->ReadFloat(&structure->softRegionThresholdHighMultiplier);
    result = result && entry->ReadInt32(&structure->softSceneChangeCount);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load chromatixPDPreprocessingType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixPDAFTypeClass::LoadchromatixPDPreprocessingType(
    ParameterFileSymbolTableEntry* entry,
    chromatixPDPreprocessingType* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadInt32(&structure->enable);
    result = result && entry->ReadInt32(&structure->enableDoNotUseDefocusSampleByPD);
    result = result && entry->ReadInt32(&structure->enableIncMinConfidenceThresholdByPD);
    result = result && entry->ReadFloat(&structure->PDMaxLimitDoNotUseDefocusSample);
    result = result && entry->ReadFloat(&structure->PDMaxLimitIncMinConfidenceThreshold);
    result = result && entry->ReadFloat(&structure->incMinConfidenceThresholdByPDScaler);
    result = result && entry->ReadFloat(&structure->PDStdThreshold);
    result = result && entry->ReadInt32(&structure->PDDefocusHighErrorScCheck);
    result = result && entry->ReadInt32(&structure->PDAverageDefocusHighErrScCheck);
    result = result && entry->ReadInt32(&structure->PDLowlightGainThresholdScCheck);

    // Reading structure->PDDefocusHighScCheck from the symbol table
    {
        result = result && entry->ReadUInt32(&structure->PDDefocusHighScCheckCount);
        structure->PDDefocusHighScCheckID = entry->ID;
        ParameterFileSymbolTableEntry* pointerEntry1 = entry->Table->ReadPointerEntry(entry);
        result = result && pointerEntry1 != NULL;
        if (result)
        {
            structure->PDDefocusHighScCheck   = PARAMETER_NEW INT32[structure->PDDefocusHighScCheckCount];
        }
        if (!result || structure->PDDefocusHighScCheck == NULL)
        {
            structure->PDDefocusHighScCheckCount = 0;
        }
        for (UINT32 i = 0; result && i < structure->PDDefocusHighScCheckCount; i++)
        {
            result = result && pointerEntry1->ReadInt32(&structure->PDDefocusHighScCheck[i]);
        }
    }

    // Reading structure->PDAverageDefocusHighScCheck from the symbol table
    {
        result = result && entry->ReadUInt32(&structure->PDAverageDefocusHighScCheckCount);
        structure->PDAverageDefocusHighScCheckID = entry->ID;
        ParameterFileSymbolTableEntry* pointerEntry1 = entry->Table->ReadPointerEntry(entry);
        result = result && pointerEntry1 != NULL;
        if (result)
        {
            structure->PDAverageDefocusHighScCheck   = PARAMETER_NEW INT32[structure->PDAverageDefocusHighScCheckCount];
        }
        if (!result || structure->PDAverageDefocusHighScCheck == NULL)
        {
            structure->PDAverageDefocusHighScCheckCount = 0;
        }
        for (UINT32 i = 0; result && i < structure->PDAverageDefocusHighScCheckCount; i++)
        {
            result = result && pointerEntry1->ReadInt32(&structure->PDAverageDefocusHighScCheck[i]);
        }
    }

    // Reading structure->PDLowlightDefocusHighScCheck from the symbol table
    {
        result = result && entry->ReadUInt32(&structure->PDLowlightDefocusHighScCheckCount);
        structure->PDLowlightDefocusHighScCheckID = entry->ID;
        ParameterFileSymbolTableEntry* pointerEntry1 = entry->Table->ReadPointerEntry(entry);
        result = result && pointerEntry1 != NULL;
        if (result)
        {
            structure->PDLowlightDefocusHighScCheck   = PARAMETER_NEW INT32[structure->PDLowlightDefocusHighScCheckCount];
        }
        if (!result || structure->PDLowlightDefocusHighScCheck == NULL)
        {
            structure->PDLowlightDefocusHighScCheckCount = 0;
        }
        for (UINT32 i = 0; result && i < structure->PDLowlightDefocusHighScCheckCount; i++)
        {
            result = result && pointerEntry1->ReadInt32(&structure->PDLowlightDefocusHighScCheck[i]);
        }
    }

    // Reading structure->PDLowlightAverageDefocusHighScCheck from the symbol table
    {
        result = result && entry->ReadUInt32(&structure->PDLowlightAverageDefocusHighScCheckCount);
        structure->PDLowlightAverageDefocusHighScCheckID = entry->ID;
        ParameterFileSymbolTableEntry* pointerEntry1 = entry->Table->ReadPointerEntry(entry);
        result = result && pointerEntry1 != NULL;
        if (result)
        {
            structure->PDLowlightAverageDefocusHighScCheck   = PARAMETER_NEW INT32[structure->PDLowlightAverageDefocusHighScCheckCount];
        }
        if (!result || structure->PDLowlightAverageDefocusHighScCheck == NULL)
        {
            structure->PDLowlightAverageDefocusHighScCheckCount = 0;
        }
        for (UINT32 i = 0; result && i < structure->PDLowlightAverageDefocusHighScCheckCount; i++)
        {
            result = result && pointerEntry1->ReadInt32(&structure->PDLowlightAverageDefocusHighScCheck[i]);
        }
    }

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load chromatixPDMonitorType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixPDAFTypeClass::LoadchromatixPDMonitorType(
    ParameterFileSymbolTableEntry* entry,
    chromatixPDMonitorType* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadInt32(&structure->waitAfterFocusCount);
    result = result && entry->ReadInt32(&structure->waitConfidenceRecoverCount);
    result = result && entry->ReadFloat(&structure->defocusedThreshold);
    result = result && entry->ReadFloat(&structure->depthStableThreshold);
    result = result && entry->ReadInt32(&structure->defocusStableFilterLength);
    result = result && entry->ReadInt32(&structure->enableTriggerSuppressionBySceneChange);
    result = result && entry->ReadFloat(&structure->defocusDOFMultiplier);
    result = result && entry->ReadFloat(&structure->defocusThresholdScaler);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load chromatixPDFocusScanType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixPDAFTypeClass::LoadchromatixPDFocusScanType(
    ParameterFileSymbolTableEntry* entry,
    chromatixPDFocusScanType* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadInt32(&structure->focusConvergeFrameSkip);
    result = result && entry->ReadInt32(&structure->enableFineScan);
    result = result && entry->ReadInt32(&structure->minimumFineScanRange);
    result = result && entry->ReadInt32(&structure->fineScanStepSize);
    result = result && entry->ReadInt32(&structure->focusDoneThreshold);
    result = result && entry->ReadInt32(&structure->enableFineScanExtension);
    result = result && entry->ReadInt32(&structure->firstRunNotConfidenceAdd);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load chromatixPDDofScalerEntryType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixPDAFTypeClass::LoadchromatixPDDofScalerEntryType(
    ParameterFileSymbolTableEntry* entry,
    chromatixPDDofScalerEntryType* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadFloat(&structure->normalizedLensPosition);
    result = result && entry->ReadFloat(&structure->dofScaler);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load chromatixPDDofScalerTableType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixPDAFTypeClass::LoadchromatixPDDofScalerTableType(
    ParameterFileSymbolTableEntry* entry,
    chromatixPDDofScalerTableType* structure)
{
    BOOL result = TRUE;

    // Reading structure->dofScalerEntries from the symbol table
    {
        result = result && entry->ReadUInt32(&structure->dofScalerEntriesCount);
        structure->dofScalerEntriesID = entry->ID;
        ParameterFileSymbolTableEntry* pointerEntry1 = entry->Table->ReadPointerEntry(entry);
        result = result && pointerEntry1 != NULL;
        if (result)
        {
            structure->dofScalerEntries   = PARAMETER_NEW chromatixPDDofScalerEntryType[structure->dofScalerEntriesCount];
        }
        if (!result || structure->dofScalerEntries == NULL)
        {
            structure->dofScalerEntriesCount = 0;
        }
        for (UINT32 i = 0; result && i < structure->dofScalerEntriesCount; i++)
        {
            result = result && LoadchromatixPDDofScalerEntryType(pointerEntry1, &structure->dofScalerEntries[i]);
        }
    }

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load chromatixPDStableTableEntryType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixPDAFTypeClass::LoadchromatixPDStableTableEntryType(
    ParameterFileSymbolTableEntry* entry,
    chromatixPDStableTableEntryType* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadInt32(&structure->FPS);
    result = result && entry->ReadInt32(&structure->minimumStableCount);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load chromatixPDStableTableType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixPDAFTypeClass::LoadchromatixPDStableTableType(
    ParameterFileSymbolTableEntry* entry,
    chromatixPDStableTableType* structure)
{
    BOOL result = TRUE;

    // Reading structure->stableEntries from the symbol table
    {
        result = result && entry->ReadUInt32(&structure->stableEntriesCount);
        structure->stableEntriesID = entry->ID;
        ParameterFileSymbolTableEntry* pointerEntry1 = entry->Table->ReadPointerEntry(entry);
        result = result && pointerEntry1 != NULL;
        if (result)
        {
            structure->stableEntries   = PARAMETER_NEW chromatixPDStableTableEntryType[structure->stableEntriesCount];
        }
        if (!result || structure->stableEntries == NULL)
        {
            structure->stableEntriesCount = 0;
        }
        for (UINT32 i = 0; result && i < structure->stableEntriesCount; i++)
        {
            result = result && LoadchromatixPDStableTableEntryType(pointerEntry1, &structure->stableEntries[i]);
        }
    }

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load chromatixPDConfidenceTableEntryType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixPDAFTypeClass::LoadchromatixPDConfidenceTableEntryType(
    ParameterFileSymbolTableEntry* entry,
    chromatixPDConfidenceTableEntryType* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadFloat(&structure->noiseGain);
    result = result && entry->ReadInt32(&structure->minimumConfidence);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load chromatixPDConfidenceTableType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixPDAFTypeClass::LoadchromatixPDConfidenceTableType(
    ParameterFileSymbolTableEntry* entry,
    chromatixPDConfidenceTableType* structure)
{
    BOOL result = TRUE;

    // Reading structure->confidenceEntries from the symbol table
    {
        result = result && entry->ReadUInt32(&structure->confidenceEntriesCount);
        structure->confidenceEntriesID = entry->ID;
        ParameterFileSymbolTableEntry* pointerEntry1 = entry->Table->ReadPointerEntry(entry);
        result = result && pointerEntry1 != NULL;
        if (result)
        {
            structure->confidenceEntries   = PARAMETER_NEW chromatixPDConfidenceTableEntryType[structure->confidenceEntriesCount];
        }
        if (!result || structure->confidenceEntries == NULL)
        {
            structure->confidenceEntriesCount = 0;
        }
        for (UINT32 i = 0; result && i < structure->confidenceEntriesCount; i++)
        {
            result = result && LoadchromatixPDConfidenceTableEntryType(pointerEntry1, &structure->confidenceEntries[i]);
        }
    }

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load chromatixPDNoiseTableEntryType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixPDAFTypeClass::LoadchromatixPDNoiseTableEntryType(
    ParameterFileSymbolTableEntry* entry,
    chromatixPDNoiseTableEntryType* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadFloat(&structure->noiseGain);
    result = result && entry->ReadFloat(&structure->noiseGainMultiplier);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load chromatixPDNoiseTableType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixPDAFTypeClass::LoadchromatixPDNoiseTableType(
    ParameterFileSymbolTableEntry* entry,
    chromatixPDNoiseTableType* structure)
{
    BOOL result = TRUE;

    // Reading structure->noiseEntries from the symbol table
    {
        result = result && entry->ReadUInt32(&structure->noiseEntriesCount);
        structure->noiseEntriesID = entry->ID;
        ParameterFileSymbolTableEntry* pointerEntry1 = entry->Table->ReadPointerEntry(entry);
        result = result && pointerEntry1 != NULL;
        if (result)
        {
            structure->noiseEntries   = PARAMETER_NEW chromatixPDNoiseTableEntryType[structure->noiseEntriesCount];
        }
        if (!result || structure->noiseEntries == NULL)
        {
            structure->noiseEntriesCount = 0;
        }
        for (UINT32 i = 0; result && i < structure->noiseEntriesCount; i++)
        {
            result = result && LoadchromatixPDNoiseTableEntryType(pointerEntry1, &structure->noiseEntries[i]);
        }
    }

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load chromatixPDFocusTableEntryType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixPDAFTypeClass::LoadchromatixPDFocusTableEntryType(
    ParameterFileSymbolTableEntry* entry,
    chromatixPDFocusTableEntryType* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadInt32(&structure->defocus);
    result = result && entry->ReadFloat(&structure->movePercent);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load chromatixPDFocusTableType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixPDAFTypeClass::LoadchromatixPDFocusTableType(
    ParameterFileSymbolTableEntry* entry,
    chromatixPDFocusTableType* structure)
{
    BOOL result = TRUE;

    // Reading structure->focusEntries from the symbol table
    {
        result = result && entry->ReadUInt32(&structure->focusEntriesCount);
        structure->focusEntriesID = entry->ID;
        ParameterFileSymbolTableEntry* pointerEntry1 = entry->Table->ReadPointerEntry(entry);
        result = result && pointerEntry1 != NULL;
        if (result)
        {
            structure->focusEntries   = PARAMETER_NEW chromatixPDFocusTableEntryType[structure->focusEntriesCount];
        }
        if (!result || structure->focusEntries == NULL)
        {
            structure->focusEntriesCount = 0;
        }
        for (UINT32 i = 0; result && i < structure->focusEntriesCount; i++)
        {
            result = result && LoadchromatixPDFocusTableEntryType(pointerEntry1, &structure->focusEntries[i]);
        }
    }

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load chromatixPDROIConfigType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixPDAFTypeClass::LoadchromatixPDROIConfigType(
    ParameterFileSymbolTableEntry* entry,
    chromatixPDROIConfigType* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadInt32(&structure->ROILocationY);
    result = result && entry->ReadInt32(&structure->ROILocationX);
    result = result && entry->ReadInt32(&structure->ROINumRows);
    result = result && entry->ReadInt32(&structure->ROINumCols);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load chromatixPDROIType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixPDAFTypeClass::LoadchromatixPDROIType(
    ParameterFileSymbolTableEntry* entry,
    chromatixPDROIType* structure)
{
    BOOL result = TRUE;

    // Reading structure->Configuration from the symbol table
    {
        result = result && entry->ReadUInt32(&structure->ConfigurationCount);
        structure->ConfigurationID = entry->ID;
        ParameterFileSymbolTableEntry* pointerEntry1 = entry->Table->ReadPointerEntry(entry);
        result = result && pointerEntry1 != NULL;
        if (result)
        {
            structure->Configuration   = PARAMETER_NEW chromatixPDROIConfigType[structure->ConfigurationCount];
        }
        if (!result || structure->Configuration == NULL)
        {
            structure->ConfigurationCount = 0;
        }
        for (UINT32 i = 0; result && i < structure->ConfigurationCount; i++)
        {
            result = result && LoadchromatixPDROIConfigType(pointerEntry1, &structure->Configuration[i]);
        }
    }

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load chromatixPDAFType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixPDAFTypeClass::LoadchromatixPDAFType(
    ParameterFileSymbolTableEntry* entry,
    chromatixPDAFType* structure)
{
    BOOL result = TRUE;
    result = result && Loadmodule_versionStruct(entry, &structure->module_version);
    result = result && Loadparameter_versionStruct(entry, &structure->parameter_version);
    result = result && entry->ReadBoolean(&structure->is2PDEnable);
    result = result && LoadchromatixPDROIType(entry, &structure->ROI);
    result = result && LoadchromatixPDFocusTableType(entry, &structure->focusTable);
    result = result && LoadchromatixPDNoiseTableType(entry, &structure->noiseTable);
    result = result && LoadchromatixPDConfidenceTableType(entry, &structure->confidenceTable);
    result = result && LoadchromatixPDConfidenceTableType(entry, &structure->confidenceHighTable);
    result = result && entry->ReadUInt32(&structure->fallbackConfidence);
    result = result && LoadchromatixPDStableTableType(entry, &structure->stableTable);
    result = result && LoadchromatixPDDofScalerTableType(entry, &structure->dofScalerTable);
    result = result && LoadchromatixPDFocusScanType(entry, &structure->focusScan);
    result = result && LoadchromatixPDMonitorType(entry, &structure->sceneMonitor);
    result = result && LoadchromatixPDPreprocessingType(entry, &structure->PDPreprocessing);
    result = result && LoadchromatixPDInternalType(entry, &structure->PDInternal);
    result = result && LoadchromatixPDMultiwindowType(entry, &structure->PDMultiWindow);
    result = result && entry->ReadInt32(&structure->enableCheckVHStatsRatio);
    result = result && entry->ReadInt32(&structure->VHStatsRatioUnconfidentThreshold);
    result = result && entry->ReadInt32(&structure->enablePDEarlyInterrupt);
    result = result && LoadledPdafMaxFrameAllowStruct(entry, &structure->ledPdafMaxFrameAllow);
    result = result && entry->ReadInt32(&structure->sparsePDTouchFaceConfidenceThreshold);
    result = result && entry->ReadInt32(&structure->sparsePDTouchFaceLowDefocusConfidenceThreshold);
    result = result && entry->ReadInt32(&structure->enableEnterLSPLowConfidenceHunting);
    result = result && entry->ReadInt32(&structure->LSPLowConfidenceHuntingThreshold);
    result = result && LoadfaceStruct(entry, &structure->face);
    result = result && LoadtouchStruct(entry, &structure->touch);
    result = result && LoadconvergeDoneFilterStruct(entry, &structure->convergeDoneFilter);
    result = result && LoadforceEnterFineSearchStruct(entry, &structure->forceEnterFineSearch);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load module_versionStruct
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixPDAFTypeClass::Loadmodule_versionStruct(
    ParameterFileSymbolTableEntry* entry,
    chromatixPDAFType::module_versionStruct* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadInt32(&structure->major_revision);
    result = result && entry->ReadInt32(&structure->minor_revision);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load parameter_versionStruct
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixPDAFTypeClass::Loadparameter_versionStruct(
    ParameterFileSymbolTableEntry* entry,
    chromatixPDAFType::parameter_versionStruct* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadInt32(&structure->major_revision);
    result = result && entry->ReadInt32(&structure->minor_revision);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load ledPdafMaxFrameAllowStruct
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixPDAFTypeClass::LoadledPdafMaxFrameAllowStruct(
    ParameterFileSymbolTableEntry* entry,
    chromatixPDAFType::ledPdafMaxFrameAllowStruct* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadInt32(&structure->enable);
    result = result && entry->ReadUInt32(&structure->maxFrameCnt);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load faceStruct
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixPDAFTypeClass::LoadfaceStruct(
    ParameterFileSymbolTableEntry* entry,
    chromatixPDAFType::faceStruct* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadUInt32(&structure->minMoveThreshold);
    result = result && LoadfaceStruct_ROIMoveConvergeSuppressStruct(entry, &structure->ROIMoveConvergeSuppress);
    result = result && LoadfaceStruct_defocusFilterStruct(entry, &structure->defocusFilter);
    result = result && LoadfaceStruct_fallbackStruct(entry, &structure->fallback);
    result = result && LoadfaceStruct_faceChangeRefocusTriggerStruct(entry, &structure->faceChangeRefocusTrigger);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load faceStruct_ROIMoveConvergeSuppressStruct
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixPDAFTypeClass::LoadfaceStruct_ROIMoveConvergeSuppressStruct(
    ParameterFileSymbolTableEntry* entry,
    chromatixPDAFType::faceStruct::ROIMoveConvergeSuppressStruct* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadBoolean(&structure->enable);
    result = result && entry->ReadUInt32(&structure->stableCountThreshold);
    result = result && entry->ReadFloat(&structure->moveThresholdInX);
    result = result && entry->ReadFloat(&structure->moveThresholdInY);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load faceStruct_defocusFilterStruct
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixPDAFTypeClass::LoadfaceStruct_defocusFilterStruct(
    ParameterFileSymbolTableEntry* entry,
    chromatixPDAFType::faceStruct::defocusFilterStruct* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadBoolean(&structure->enable);
    result = result && entry->ReadUInt32(&structure->length);
    result = result && entry->ReadUInt32(&structure->confidenceHighThreshold);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load faceStruct_fallbackStruct
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixPDAFTypeClass::LoadfaceStruct_fallbackStruct(
    ParameterFileSymbolTableEntry* entry,
    chromatixPDAFType::faceStruct::fallbackStruct* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadBoolean(&structure->enable);
    result = result && entry->ReadUInt32(&structure->fallbackROISizeThreshold);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load faceStruct_faceChangeRefocusTriggerStruct
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixPDAFTypeClass::LoadfaceStruct_faceChangeRefocusTriggerStruct(
    ParameterFileSymbolTableEntry* entry,
    chromatixPDAFType::faceStruct::faceChangeRefocusTriggerStruct* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadBoolean(&structure->enable);
    result = result && entry->ReadFloat(&structure->roiChangeThreshPercentage);
    result = result && entry->ReadUInt32(&structure->roiSizeStableThresh);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load touchStruct
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixPDAFTypeClass::LoadtouchStruct(
    ParameterFileSymbolTableEntry* entry,
    chromatixPDAFType::touchStruct* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadFloat(&structure->offCenterThreshold);
    result = result && entry->ReadInt32(&structure->skipSearchIfSceneInFocus);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load convergeDoneFilterStruct
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixPDAFTypeClass::LoadconvergeDoneFilterStruct(
    ParameterFileSymbolTableEntry* entry,
    chromatixPDAFType::convergeDoneFilterStruct* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadBoolean(&structure->enable);
    result = result && entry->ReadUInt32(&structure->length);
    result = result && entry->ReadUInt32(&structure->threshold);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load forceEnterFineSearchStruct
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixPDAFTypeClass::LoadforceEnterFineSearchStruct(
    ParameterFileSymbolTableEntry* entry,
    chromatixPDAFType::forceEnterFineSearchStruct* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadBoolean(&structure->enable);
    result = result && entry->ReadUInt32(&structure->directionReverseCountThreshold);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Unload chromatixPDPreprocessingType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void chromatixPDAFTypeClass::UnloadchromatixPDPreprocessingType(
    chromatixPDPreprocessingType* structure)
{
    PARAMETER_DELETE[] structure->PDDefocusHighScCheck;
    PARAMETER_DELETE[] structure->PDAverageDefocusHighScCheck;
    PARAMETER_DELETE[] structure->PDLowlightDefocusHighScCheck;
    PARAMETER_DELETE[] structure->PDLowlightAverageDefocusHighScCheck;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Unload chromatixPDDofScalerTableType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void chromatixPDAFTypeClass::UnloadchromatixPDDofScalerTableType(
    chromatixPDDofScalerTableType* structure)
{
    PARAMETER_DELETE[] structure->dofScalerEntries;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Unload chromatixPDStableTableType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void chromatixPDAFTypeClass::UnloadchromatixPDStableTableType(
    chromatixPDStableTableType* structure)
{
    PARAMETER_DELETE[] structure->stableEntries;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Unload chromatixPDConfidenceTableType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void chromatixPDAFTypeClass::UnloadchromatixPDConfidenceTableType(
    chromatixPDConfidenceTableType* structure)
{
    PARAMETER_DELETE[] structure->confidenceEntries;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Unload chromatixPDNoiseTableType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void chromatixPDAFTypeClass::UnloadchromatixPDNoiseTableType(
    chromatixPDNoiseTableType* structure)
{
    PARAMETER_DELETE[] structure->noiseEntries;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Unload chromatixPDFocusTableType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void chromatixPDAFTypeClass::UnloadchromatixPDFocusTableType(
    chromatixPDFocusTableType* structure)
{
    PARAMETER_DELETE[] structure->focusEntries;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Unload chromatixPDROIType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void chromatixPDAFTypeClass::UnloadchromatixPDROIType(
    chromatixPDROIType* structure)
{
    PARAMETER_DELETE[] structure->Configuration;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Unload chromatixPDAFType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void chromatixPDAFTypeClass::UnloadchromatixPDAFType(
    chromatixPDAFType* structure)
{
    UnloadchromatixPDROIType(&structure->ROI);
    UnloadchromatixPDFocusTableType(&structure->focusTable);
    UnloadchromatixPDNoiseTableType(&structure->noiseTable);
    UnloadchromatixPDConfidenceTableType(&structure->confidenceTable);
    UnloadchromatixPDConfidenceTableType(&structure->confidenceHighTable);
    UnloadchromatixPDStableTableType(&structure->stableTable);
    UnloadchromatixPDDofScalerTableType(&structure->dofScalerTable);
    UnloadchromatixPDPreprocessingType(&structure->PDPreprocessing);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Parse symbol table entry, and return a new object
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ParameterModule* chromatixPDAFTypeClass::Parse(
    ParameterSetManager* manager,
    ParameterFileSymbolTableEntry* entry) const
{
    chromatixPDAFTypeClass* cls = NULL;

    if (PARAMETER_STRCMP(Type, entry->Type) == 0 && Major == entry->Major &&
        Minor == entry->Minor && Patch == entry->Patch)
    {
        cls = PARAMETER_NEW chromatixPDAFTypeClass(GetName(entry->Type), 
            entry->ModeId, entry->Mode, entry->SubMode, entry->Group);
        if (cls != NULL)
        {
            BOOL result = TRUE;

            cls->SymbolTableID = entry->ID;
            cls->ID            = entry->ID;

            result = result && LoadchromatixPDAFType(entry, cls);

            if (!result)
            {
                PARAMETER_DELETE cls;
                cls = NULL;
            }
        }
    }
    return (ParameterModule*)cls;
}


AFPDAFELEMENTS_NAMESPACE_END
